package com.qiaofang.dataprocessing.facade.impl;

import com.qiaofang.common.request.DataRequest;
import com.qiaofang.common.response.DataResultResponse;
import com.qiaofang.dataprocessing.service.EmployeeService;
import com.qiaofang.dataprocessing.service.MessageService;
import com.qiaofang.dataprocessing.service.PropertyService;
import com.qiaofang.dataprocessing.service.SysFieldSyncService;
import com.qiaofang.dataprocessing.stub.bean.EmpManageDTO;
import com.qiaofang.dataprocessing.stub.bean.EmployeeCountDTO;
import com.qiaofang.dataprocessing.stub.bean.ListVerifyCodeDTO;
import com.qiaofang.dataprocessing.stub.bean.ProRightsInterestsDTO;
import com.qiaofang.dataprocessing.stub.bean.request.PropertyEmpOrderRequest;
import com.qiaofang.dataprocessing.stub.bean.request.SysFieldSyncRequest;
import com.qiaofang.dataprocessing.stub.bean.response.HistoryConsignCodeDTO;
import com.qiaofang.dataprocessing.stub.bean.response.PropertyWaterMarkDTO;
import com.qiaofang.dataprocessing.stub.bean.response.SysFieldSyncResponse;
import com.qiaofang.dataprocessing.stub.facade.MiniProgramDataSyncFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by IDEA.
 *
 * @auther Zym.
 * @company qiaofang
 * @date 2020/11/18 14:03
 */
@RestController
public class MiniProgramDataSyncFacadeImpl implements MiniProgramDataSyncFacade {

    @Autowired
    private SysFieldSyncService sysFieldSyncService;

    @Autowired
    private PropertyService propertyService;

    @Autowired
    private EmployeeService employeeService;

    @Autowired
    private MessageService messageService;


    @Override
    public DataResultResponse<SysFieldSyncResponse> sysFieldList(@RequestBody DataRequest<SysFieldSyncRequest> request) {
        return DataResultResponse.ok(sysFieldSyncService.getSyncResponse(request.getParam().getTiming()));
    }

    @Override
    public DataResultResponse<List<ProRightsInterestsDTO>> getProRightsInterests(@RequestBody DataRequest<SysFieldSyncRequest> request) {
        return DataResultResponse.ok(propertyService.getProRightsInterests(request.getParam().getTiming()));
    }

    @Override
    public DataResultResponse<List<String>> getProEmpOrder(@RequestBody DataRequest<PropertyEmpOrderRequest> request) {
        return DataResultResponse.ok(propertyService.getProEmpOrder(request.getParam()));
    }

    @Override
    public DataResultResponse<List<ListVerifyCodeDTO>> getV10PropertFieldyByParam() {
        return DataResultResponse.ok(propertyService.getPropertFieldyByParam());
    }

    @Override
    public DataResultResponse<List<HistoryConsignCodeDTO>> getHistoryConsignCode() {
        return DataResultResponse.ok(propertyService.getHistoryConsignCode());
    }

    @Override
    public DataResultResponse<EmpManageDTO> getEmpManageData() {
        return DataResultResponse.ok(employeeService.getEmpManageDTO());
    }

    @Override
    public DataResultResponse<List<EmployeeCountDTO>> getInspectionCountList() {
        return DataResultResponse.ok(employeeService.getInspectionCountList());
    }

    @Override
    public DataResultResponse<List<EmployeeCountDTO>> getTransactionCountList() {
        return DataResultResponse.ok(employeeService.getTransactionCountList());
    }

    @Override
    public DataResultResponse<Map<String, List<String>>> getPropertyTypeMap(@RequestBody DataRequest<SysFieldSyncRequest> request) {
        return DataResultResponse.ok(propertyService.getPropertyTypeMap(request.getParam()));
    }

    @Override
    public DataResultResponse<PropertyWaterMarkDTO> getPropertyImgWatermark() {
        return DataResultResponse.ok(propertyService.getPropertyImgWatermark());
    }

    @Override
    public DataResultResponse<Integer> deleteMessageWeekAgo() {
        return DataResultResponse.ok(messageService.deleteMessageWeekAgo());
    }
}
